#ifndef SERVERDIALOG_H
#define SERVERDIALOG_H

#include <QDialog>
#include <QTcpServer>
#include <QTcpSocket>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class ServerDialog; }
QT_END_NAMESPACE

class ServerDialog : public QDialog
{
    Q_OBJECT

public:
    ServerDialog(QWidget *parent = nullptr);
    ~ServerDialog();

private slots:
    void on_CreateButton_clicked();
    void on_Newconnection(void);
    void on_ReadyRead(void);
    void sendQMessage (const QByteArray& readbuf);
    void sendSMessage (const QByteArray& readbuf);
private:
    Ui::ServerDialog *ui;
    QTcpServer tcpServer;
    quint16 port;//端口号
    QList <QTcpSocket*> tcpClientList;//保存和客户端通信的套接子
    QString name[10];
    QString nameSend;
    int first_name[10];
    int serverNum;
    QString msg;
};
#endif // SERVERDIALOG_H
